from typing import TypeVar, Generic, List, Optional
from pydantic import BaseModel

DataType = TypeVar('DataType')

class APIResponse(BaseModel, Generic[DataType]):
    success: bool
    data: List[DataType] = []
    count: int
    message: Optional[str] = None
    
    class Config:
        schema_extra = {
            "example": {
                "success": True,
                "data": [],
                "count": 0,
                "message": "成功获取数据"
            }
        }